package com.example.demo.util;

public class ThreadGroupTest {
    public static void main(String[] args) {
        //创建线程组
        ThreadGroup threadGroup = new ThreadGroup("zha");

        Thread thread = new Thread(threadGroup, () -> {
            //线程组名称
            String groupName = Thread.currentThread().getThreadGroup().getName();
            //线程名称
            String threadName = Thread.currentThread().getName();
            System.out.println("groupName = " + groupName);
            System.out.println("threadName = " + threadName);
        }, "thread");
        thread.start();
    }

}
